(function($){
	$(document).ready(function(){
		$("#id_group").change(function(e){
			$("#id_studios_to").html("");
			SelectBox.init('id_studios_to');
			$.getJSON("/get_included_studios/", {'id': e.target.value}, function(data){
				if(data.status == 1){
					var html = ""
					$.each(data.studios, function(k, v){
						html += "<option value='" + v.id + "'>" + v.name + "</option>"; 
					});
					$("#id_studios_from").html(html);
					SelectBox.init('id_studios_from');
					if(html != ""){
						$("#id_studios_add_all_link").addClass('active');
					}else{
						$("#id_studios_add_all_link").removeClass('active');
					}
				}
	    	});
		});
	});
})(django.jQuery);